﻿<s:SurfaceListBox x:Class="ScrumTable.UI.View.WinTouch.UserControls.SurfaceDragDropListBox"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="http://schemas.microsoft.com/surface/2008"
    xmlns:CustomControl="clr-namespace:ScrumTable.UI.View.CustomControl;assembly=ScrumTable.UI.View" xmlns:Converter="clr-namespace:ScrumTable.UI.View.Converter;assembly=ScrumTable.UI.View" x:Name="TheListBox"  ScrollViewer.VerticalScrollBarVisibility="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Orientation, Converter={StaticResource IsVerticalVisible}}"  ScrollViewer.HorizontalScrollBarVisibility="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Orientation, Converter={StaticResource IsHorizontalVisible}}">
    <!--TODO faster effects -->
    
    <s:SurfaceListBox.Resources>
        <Color x:Key="EffectColor">#55000000</Color>
        <Style x:Key="{x:Type s:SurfaceListBoxItem}" TargetType="{x:Type s:SurfaceListBoxItem}">
            <Setter Property="Template">
                <Setter.Value>                    
                    <ControlTemplate TargetType="{x:Type s:SurfaceListBoxItem}">                       
                        <Border Name="Border" Padding="2" SnapsToDevicePixels="true">                           
                           <ContentPresenter/>                          
                        </Border>       
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="true">
                                <Setter TargetName="Border" Property="Effect">
                                    <Setter.Value>
                                        <DropShadowEffect x:Name="borderDropShadowEffect" RenderingBias="Performance" BlurRadius="10"   ShadowDepth="5"  Direction="-45" Color="{DynamicResource EffectColor}"  />
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter Property="OpacityMask" Value="{StaticResource disabledMask}" />
                            </Trigger>
                        </ControlTemplate.Triggers>     
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="NoSelectionStyle" TargetType="{x:Type s:SurfaceListBoxItem}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type s:SurfaceListBoxItem}">
                        <Border Name="Border" Padding="2" SnapsToDevicePixels="true">
                            <ContentPresenter/>
                        </Border>

                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="true"/>                                

                            <Trigger Property="IsEnabled" Value="False">
                                <Setter Property="OpacityMask" Value="{StaticResource disabledMask}" />
                            </Trigger>

                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </s:SurfaceListBox.Resources>
  
    <s:SurfaceListBox.ItemsPanel>
        <ItemsPanelTemplate>
            <CustomControl:VirtualizingMultiLinePanel Orientation="{Binding ElementName=TheListBox, Path=Orientation}" ShowContentCenter="False" />              
         </ItemsPanelTemplate>
    </s:SurfaceListBox.ItemsPanel>
</s:SurfaceListBox>
